﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MerchantLogin.aspx.cs" Inherits="MerchantLogin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/design.css" rel="stylesheet" type="text/css" />
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/style-responsive.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/style-metro.css" />
    <script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <%--css for model--%>
    <link href="css/bootstrap-modal.css" rel="stylesheet" type="text/css" />
    <style>
        .page-header-fixed .page-container
        {
            margin-top: 0px !important;
        }
        .modal.fade.in
        {
            top: 50px !important;
        }
        @media (min-width: 768px)
        {
            .row-fluid .offset3
            {
                margin-left: 30.641% !important;
            }
        }
    </style>
    <%--css for delete confirmation box--%>
    <link href="css/Popup.css" rel="stylesheet" type="text/css" />
</head>
<body style="background: url('img/registration1_bg.jpg') #8AC0A9;">
    <form id="form2" runat="server">
    <asp:ScriptManager runat="server" ID="sm1">
    </asp:ScriptManager>
    <div class="page-container">
        <div class="container_main">
            <div class="row-fluid">
                <div class="span5 offset3" style="margin-top: 75px; font-family: Verdana;">
                    <h3 class="login_top_heading white_color">
                        <img src="img/logo.png" alt="" />
                    </h3>
                    <h3 class="login_top_heading white_color">
                        MERCHANT LOGIN</h3>
                    <div class="inner_dark">
                        <div style="padding: 20px 10px;">
                            <div id="divMessage" runat="server" class="generalMessage">
                            </div>
                            <asp:Label runat="server" ID="lblId" CssClass="lblclass"></asp:Label>
                            <div class="offset2 span7">
                                <div class="control-group " id="divUserName">
                                    <label class="control-label">
                                        EMAIL ID:</label>
                                    <div class="controls">
                                        <asp:TextBox runat="server" ID="txtUserName" TabIndex="1" CssClass="m-wrap txt_bg span12 loginusername"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="control-group " id="divPasswordInfo">
                                    <label class="control-label">
                                        PASSWORD:</label>
                                    <div class="controls">
                                        <asp:TextBox runat="server" ID="txtPassword" TabIndex="2" TextMode="Password" CssClass="m-wrap txt_bg span12 passwordInfo"></asp:TextBox>
                                    </div>
                                </div>
                                <a href="#" class="link_pwd pull-right" onclick="OpenPopup();">Forgot your password?</a>
                                <div class="clearfix">
                                </div>
                            </div>
                            <div class="clearfix">
                            </div>
                            <div class="row-fluid">
                                <div class="span7">
                                </div>
                                <div class="mt_lg span2">
                                    <%--    <asp:Button ID="btnLogin" Style="display: none;" runat="server" OnClick="OnLogin"
                                        TabIndex="3" CssClass="login_bg frmValidation" Text="Login" />--%>
                                    <a href="#" onclick="return checkUser();" tabindex="3" class="login_bg frmValidation">
                                        Login</a>
                                </div>
                            </div>
                            <div class="clearfix">
                            </div>
                        </div>
                    </div>
                </div>
                <!-- inner dark  --->
            </div>
            <a class=" " data-toggle="modal" id="astatic" style="display: none;" href="#static">
                Demo</a>
            <h6 class="copyright white_color">
                COPYRIGHT © 2014 FONEBUDDY.COM</h6>
        </div>
    </div>
    <div class="span12">
        <!-- BEGIN PORTLET-->
        <div class="portlet-body form">
            <div id="responsive" class="modal hide fade" tabindex="-1" data-width="760">
                <div id="static" class="modal hide fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
                    <div class="modal-body">
                        <p>
                            Your subscription is expired please renew now..</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" data-dismiss="modal" class="btn">
                            Cancel</button>
                        <button type="button" data-dismiss="modal" runat="server" id="cancel" onserverclick="OnUpgrade"
                            class="btn green">
                            Renew Now</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- END PORTLET-->
    </div>
    <div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"
        aria-hidden="true" style="top: 30%; opacity: 1.5;">
        <div class="modal-header">
            <h3 id="myModalLabel2">
                Forgot Password</h3>
        </div>
        <div class="modal-body">
         <div id="divForget" runat="server" class="forgetpwdMessage">
                            </div>
            <div class="row-fluid">
                <div class="span3">
                    <div class="control-group">
                        <label for="selectstore" class="control-label">
                            Enter EmailId</label>
                    </div>
                </div>
                <div class="span9">
                    <div class="control-group">
                        <asp:TextBox runat="server" ID="txtOldEmailId" CssClass="forgetEmailId"></asp:TextBox>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <asp:Button ID="btnGo" runat="server" OnClick="OnForgotPassword" data-dismiss="modal" class="btn f_passwordvalidation"
                Text="Go" />
            <input type="button" class="btn closebox" value="Close" onclick="closePopUp();" />
        </div>
    </div>
    <div class="modal-backdrop hide">
    </div>
    <script type="text/javascript">
        var msg = "Please Enter EmailId.";
        var isError = "false";
          $('.f_passwordvalidation').click(function () {
              var isError = "false";

            if ($('.forgetEmailId').val() == "") {

                $('.forgetEmailId').closest("div #myModal2").addClass("error");
                isError = "true";
            }
            else {
                $('.forgetEmailId').closest("div #myModal2").removeClass("error");

            }
            if (isError == "true") {
                $(".forgetpwdMessage").html("<strong>Error!</strong> " + msg);
                $(".forgetpwdMessage").addClass("alert alert-danger");
                return false;
            }
          });
    </script>
    <script type="text/javascript">
        var msg = "Please check your validations in red.";
        var isError = "false";
        $('.frmValidation').click(function () {

            var isError = "false";

            if ($('.loginusername').val() == "") {

                $('.loginusername').closest("div #divUserName").addClass("error");
                isError = "true";
            }
            else {
                $('.forgetEmailId').closest("div #divUserName").removeClass("error");

            }
            if ($('.loginusername').val() == "") {

                isError = "true";
                $('.passwordInfo').closest("div #divPasswordInfo").addClass("error");
            }
            else {
                $('.passwordInfo').closest("div #divPasswordInfo").removeClass("error");

            }
            if (isError == "true") {
                $(".generalMessage").html("<strong>Error!</strong> " + msg);
                $(".generalMessage").addClass("alert alert-danger");
                return false;
            }
        });
        function checkUser() {
            $(".generalMessage").html("");
            $(".generalMessage").removeClass("alert alert-danger");

            if ($('.loginusername').val() != "" && $('.passwordInfo').val() != "") {
                $.ajax({
                    type: "POST",
                    url: "./MerchantLogin.aspx/checkMail",
                    contentType: "application/json; charset=utf-8",
                    data: "{emailid:'" + $('.loginusername').val() + "',password:'" + $('.passwordInfo').val() + "'}",
                    dataType: "json",
                    success: function (response) {

                        if (response.d[0] == "true") {

                            document.getElementById('astatic').click();
                            return false;
                        }
                        if (response.d[0] == "false") {
                            if (response.d[1] == "0") {
                                $(".generalMessage").html("<strong>Error!</strong> " + "Invalid Username Password!!");
                                $(".generalMessage").addClass("alert alert-danger");
                                return false
                            }
                            else
                                window.location.href = "./MerchantDashBoard.aspx";
                            //document.getElementById('btnLogin').click();
                        }
                    },
                    failure: function () {
                    }
                });
            }
        }

        function OpenPopup() {
            $("#myModal2").show();
            $('.modal-backdrop').show();
        }
        function closePopUp() {
            $("#myModal2").hide();
            $('.modal-backdrop').hide();
        }
    </script>
    <%--  msg popup--%>
    <script src="js/bootstrap-modal.js" type="text/javascript"></script>
    <script src="js/bootstrap-modalmanager.js" type="text/javascript"></script>
    <script src="js/ui-modals.js"></script>
    </form>
</body>
</html>
